<?php

namespace app\index\controller;

use think\Controller;

class Btc extends Controller
{

    public function index()
    {
        return $this->fetch();
    }

    public function getPrices()
    {
        // CURL
        $curl = curl_init();
        // URL 设置
        $url = 'https://blockchain.info/ticker';
        curl_setopt($curl, CURLOPT_URL, $url);
        // 将curl_exec()获取的信息以字符串返回，而不是直接输出。
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
        // 设定为 不验证证书host
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);

        // CURL 执行
        $data = curl_exec($curl);

        curl_close($curl);

        echo $data;
    }


}
